interface Animal {
  name: string,
  age: number
}
interface Person {
  name: string,
  age: number,
  gender: number
}
// 要判断目标类型`Person`是否能够兼容输入的源类型`Animal`
function getName(animal: Animal): string {
  return animal.name;
}
let p = {
  name: 'yh',
  age: 20,
  gender: 0
}
console.log(getName(p));
// 只有在传参的时候两个变量之间才会进行兼容性的比较，赋值的时候并不会比较,会直接报错时候
// let a: Animal = {
//   name: 'yh',
//   age: 20,
//   gender: 0
// }

interface Empty<T> { };
let x!: Empty<string>;
let y!: Empty<number>;
x = y;
console.log(x == y)

type isNever = never extends unknown ? true : false;
type NonNullable1<T> = T extends null | undefined ? never : T;
type E = NonNullable1<string | number | null | undefined>;
let e: E = null
console.log(e)